import React, { useEffect, useState } from 'react';
import { Button, Form, Row, Col, Modal, Cascader, Select, DatePicker, Upload, message, Space, Input, TreeSelect, Popconfirm } from 'antd';
import TextArea from 'antd/es/input/TextArea';
import { UploadOutlined } from '@ant-design/icons';
import dayjs from 'dayjs';
import condition from '@/components/staticFile/treeSelect.json';
import { useLocation, useModel, useNavigate } from '@umijs/max';
import { demand, situation, step1, step2, twoChangeToConfirm, uploadFile } from '@/services/apis/companyRegister';

// 统一样式常量
const COMMON_FIELD_STYLE = { width: '100%', height: 40, borderRadius: 4 };
const FORM_LAYOUT = {
    labelCol: { span: 5 },
    wrapperCol: { span: 19 },
    layout: 'horizontal' as const,
    
    size: 'middle' as const,
};

const DigitalFormModal: React.FC = () => {
    const [form] = Form.useForm();
    const [loading, setLoading] = useState(false);
    const { initialState } = useModel('@@initialState');
    const [hetongList, setHetongList] = useState<{ [key: string]: [] }>({})
    const { dataGlobal, setDataGlobal } = useModel('DigitalizationManager.dataGlobal');
    const [senceList, setSenceList] = useState<any[]>([]);
    const [xydmList, setXydmList] = useState<any[]>([])
    const location = useLocation();
    const navigate = useNavigate();
    const {
        modalProps,
        setModalProps,
    } = useModel("DigitalizationManager.modal")


    // 递归生成完整路径的Map（用于TreeSelect）
    const buildFullPathMap = (
        nodes: any[],
        parentPath: string[] = [],
        map: Record<string, string[]> = {},
    ) => {
        nodes.forEach((node) => {
            const currentPath = [...parentPath, node.title];
            map[node.value] = currentPath;
            if (node.children && node.children.length) {
                buildFullPathMap(node.children, currentPath, map);
            }
        });
        return map;
    };

    const fullPathMap = buildFullPathMap(condition);

    const convertNode = (node: any) => ({
        title: node.title,
        value: node.value,
        disabled: node.children && node.children.length > 0,
        children: node.children?.map(convertNode),
    });

    useEffect(() => {
        if (modalProps.visible) {
            const fetchData = async () => {
                const companyId = (initialState?.currentUser as any)?.data?.id;
                if (!companyId) return;

                const [demandRes, situationRes] = await Promise.all([
                    demand({ companyId }),
                    situation({ companyId }),
                ]);

                let demandFormData = {};
                if (demandRes.code === "0") {
                    demandFormData = demandRes.data.scenesData.reduce((pre: any, cur: any) => {
                        pre[cur.label] = cur.scenes;
                        return pre;
                    }, {});
                }

                let situationFormData = {};
                if (situationRes.code === "0") {
                    const hetongL: { [key: string]: any } = {}
                    situationFormData = {
                        ...situationRes.data,
                        digitalContentList: situationRes.data.digitalContentList?.map((item: any, index: number) => {
                            const key = ["digitalContentList", index, 'changeContract'].join("_")
                            hetongL[key] = item.changeContract?.map((fileItem: any) =>
                                ({ ...fileItem, name: fileItem.filename, uid: Math.random().toString() }))

                            return ({
                                ...item,
                                programEnd: dayjs(item.programEnd),
                                programStart: dayjs(item.programStart),
                            })
                        })
                    };
                    setHetongList(hetongL)
                }

                form.setFieldsValue({ ...demandFormData, ...situationFormData });
            };

            fetchData();
        } else {
            form.resetFields();
        }
    }, [modalProps.visible, initialState, form]);

    const onCancel = () => {
        setModalProps({ visible: false })
    }
    // 表单提交处理
    const handleSubmit = async () => {
        try {
            setLoading(true);
            const values = await form.validateFields();
            const companyId = (initialState?.currentUser as any)?.data?.id;
            const scenesData = Object.keys(values).filter(item =>
                condition.some(cond => cond.title.includes(item)) && values[item]
            ).map(item => ({ label: item, scenes: values[item] }));
            values.scenesData = scenesData
            values.digitalContentList = values.digitalContentList?.map((item: any) => ({
                ...item,
                programStart: item.programStart?.format('YYYY-MM-DD'),
                programEnd: item.programEnd?.format('YYYY-MM-DD'),
            }))
            const submitResult = await twoChangeToConfirm({ ...values, companyId, projectId: dataGlobal.setpThree.projectId })
            const { code } = submitResult;
            if (code == "0") {
                navigate("/api_status_page", {
                    state: {
                        title: "项目备案信息二次审核",
                        message: "项目备案信息进入二次审核",
                        callbackUrl: location.pathname
                    }
                });
                setModalProps({ visible: false })
            } else {
                navigate("/api_status_page", {
                    state: {
                        title: "项目备案信息二次审核",
                        message: "项目备案信息进入二次审核失败",
                        callbackUrl: location.pathname
                    }
                });
            }
        } catch (error) {
            console.error('表单提交失败：', error);
            message.error('提交失败，请检查表单数据');
        } finally {
            setLoading(false);
        }
    };

    const handleAutoUpload = async (file: any, formPath: any) => {

        try {
            const response = await uploadFile(file)
            if (response.code == "0") {
                setHetongList(prev => ({ ...prev, [formPath.join("_")]: [{ name: response.data.filename, uid: Math.random().toString() }] }))
                form.setFieldValue(formPath, [response.data])

            }
        } catch (error) {
        }
    };

    return (
        <Modal
            title="数字化改造信息填写"
            open={modalProps.visible}
            onCancel={onCancel}
            footer={null}
            width={900}
            destroyOnClose
            maskClosable={false}
        >
            <div style={{ padding: 20, backgroundColor: '#f8f9fa', boxSizing: 'border-box' }}>
                <div
                    style={{
                        backgroundColor: '#fff',
                        padding: 20,
                        borderRadius: 8,
                        boxShadow: '0 1px 3px rgba(0,0,0,0.05)',
                    }}
                >
                    <Form {...FORM_LAYOUT} form={form} >
                        <div
                            style={{
                                fontSize: 16,
                                fontWeight: 500,
                                color: '#1f2937',
                                marginBottom: 12,
                            }}
                        >
                            数字化改造需求
                        </div>
                        {condition.map((item, index) => {
                            return (
                                <>
                                    <div
                                        style={{
                                            fontSize: 16,
                                            fontWeight: 500,
                                            color: '#1f2937',
                                            marginBottom: 12,
                                            textIndent: 25
                                        }}
                                    >
                                        {item.title.includes(".") ? item.title.split(".")[1] : item.title}面临需求
                                    </div>
                                    <Form.List name={`${item.title.includes(".") ? item.title.split(".")[1] : item.title}`}>
                                        {(fields, { add, remove }) => (
                                            <>
                                                {fields.map(({ key, name, ...restField }) => (
                                                    <div
                                                        key={key}
                                                        style={{
                                                            marginBottom: 24,
                                                            borderBottom: '1px solid #e8e8e8',
                                                            paddingBottom: 16,
                                                        }}
                                                    >
                                                        <Row justify="space-between" align="middle">
                                                            <Col>
                                                                <div
                                                                    style={{
                                                                        fontSize: 16,
                                                                        fontWeight: 500,
                                                                        color: '#1f2937',
                                                                        marginBottom: 12,
                                                                    }}
                                                                >
                                                                    场景 {name + 1}
                                                                </div>
                                                            </Col>
                                                            <Col>
                                                                <Popconfirm title="是否删除" onConfirm={() => remove(name)}>
                                                                    <Button type="link" danger>
                                                                        删除
                                                                    </Button>
                                                                </Popconfirm>

                                                            </Col>
                                                        </Row>

                                                        {/* 场景选择 */}
                                                        <Form.Item
                                                            {...restField}
                                                            label="场景"
                                                            name={[name, 'scene']}
                                                            rules={[{ required: true, message: '请选择场景' }]}
                                                            style={{ marginBottom: 20 }}
                                                        >
                                                            <Cascader
                                                                allowClear
                                                                placeholder="请选择场景"
                                                                style={COMMON_FIELD_STYLE}
                                                                options={condition}
                                                                fieldNames={{ label: 'title' }}
                                                                showSearch
                                                            />
                                                        </Form.Item>

                                                        {/* 场景描述 */}
                                                        <Form.Item
                                                            {...restField}
                                                            label="场景描述"
                                                            name={[name, 'sceneDesc']}
                                                            rules={[{ required: true, message: '请输入场景描述' }]}
                                                            style={{ marginBottom: 20 }}
                                                        >
                                                            <TextArea
                                                                placeholder="请输入场景描述"
                                                                allowClear
                                                                showCount
                                                                maxLength={500}
                                                                style={{
                                                                    minHeight: 120,
                                                                    maxHeight: 200,
                                                                    resize: 'vertical',
                                                                    ...COMMON_FIELD_STYLE,
                                                                }}
                                                            />
                                                        </Form.Item>

                                                        {/* 问题及需求分析 */}
                                                        <Form.Item
                                                            {...restField}
                                                            label="问题及需求分析"
                                                            name={[name, 'problemAnalysis']}
                                                            rules={[{ required: true, message: '请输入问题及需求分析' }]}
                                                            style={{ marginBottom: 20 }}
                                                        >
                                                            <TextArea
                                                                placeholder="请输入问题及需求分析"
                                                                allowClear
                                                                showCount
                                                                maxLength={500}
                                                                style={{
                                                                    minHeight: 120,
                                                                    maxHeight: 200,
                                                                    resize: 'vertical',
                                                                    ...COMMON_FIELD_STYLE,
                                                                }}
                                                            />
                                                        </Form.Item>
                                                    </div>
                                                ))}

                                                <Form.Item wrapperCol={{ offset: 5, span: 19 }} style={{ marginTop: 40, textAlign: "center" }}>
                                                    <Button type="primary" onClick={() => add()} >
                                                        + 新增场景
                                                    </Button>
                                                </Form.Item>
                                            </>
                                        )}
                                    </Form.List>
                                </>
                            );
                        })}
                        <div style={{ marginBottom: 24 }}>
                            <div
                                style={{
                                    fontSize: 16,
                                    fontWeight: 500,
                                    color: '#1f2937',
                                    marginBottom: 12,
                                }}
                            >
                                基本情况
                            </div>

                            {/* <Form.Item
                        name="enterpriseName"
                        label="企业名称"
                        rules={[{ required: true, message: '请输入企业名称' }]}
                        style={{ marginBottom: 20 }}
                      >
                        <Input style={COMMON_FIELD_STYLE} />
                      </Form.Item> */}
                            <Form.Item label="数字化水平等级(改造前)" style={{ marginBottom: 20 }}>

                                <Space.Compact style={{ width: '100%' }}>
                                    <Form.Item
                                        name="digitalLevel"
                                        noStyle
                                        rules={[{ required: true, message: '请选择数字化水平等级' }]}

                                    >
                                        <Select
                                            style={{ ...COMMON_FIELD_STYLE, flex: 1 }}
                                            // 添加表单绑定属性
                                            value={form.getFieldValue('digitalLevel')}
                                            onChange={(value) => form.setFieldValue('digitalLevel', value)}
                                        >
                                            <Select.Option value="level1">一级</Select.Option>
                                            <Select.Option value="level2">二级</Select.Option>
                                            <Select.Option value="level3">三级</Select.Option>
                                            <Select.Option value="level4">四级</Select.Option>
                                        </Select>
                                    </Form.Item>

                                    <Button
                                        style={{ ...COMMON_FIELD_STYLE, width: 'auto' }}
                                        type="primary"
                                        onClick={() =>
                                            window.open(
                                                'https://ucenter.miit.gov.cn/login.jsp?toUrl=http%3A%2F%2Fzjtx.miit.gov.cn%2Fqyxx%2Fgotoszhsp',
                                            )
                                        }
                                    >
                                        去测试
                                    </Button>
                                </Space.Compact>
                            </Form.Item>
                            <Form.Item
                                name="transformationInvestment"
                                label="改造总花费(万元)"
                                rules={[{ required: true, message: '请输入改造总花费', pattern: /^\d+(\.\d+)?$/ }]}
                                style={{ marginBottom: 20 }}
                            >
                                <Input style={COMMON_FIELD_STYLE} />
                            </Form.Item>
                        </div>

                        <div style={{ marginBottom: 24 }}>
                            <div style={{ borderBottom: '1px solid #e8e8e8', marginBottom: 20 }}></div>

                            <div
                                style={{
                                    fontSize: 16,
                                    fontWeight: 500,
                                    color: '#1f2937',
                                    marginBottom: 12,
                                }}
                            >
                                新增/修改数字化改造内容
                            </div>
                            <Form.List name="digitalContentList">
                                {(fields, { add, remove }) => (
                                    <>
                                        {fields.map(({ key, name, ...restField }) => (
                                            <div
                                                key={key}
                                                style={{
                                                    marginBottom: 24,
                                                    borderBottom: '1px solid #e8e8e8',
                                                    paddingBottom: 16,
                                                }}
                                            >
                                                <Row justify="space-between" align="middle">
                                                    <Col>
                                                        <div
                                                            style={{
                                                                fontSize: 16,
                                                                fontWeight: 500,
                                                                color: '#1f2937',
                                                                marginBottom: 12,
                                                                marginLeft: 12,
                                                            }}
                                                        >
                                                            内容 {name + 1}
                                                        </div>
                                                    </Col>
                                                    <Col>
                                                        <Popconfirm title="是否删除" onConfirm={() => remove(name)}>
                                                            <Button type="link" danger>
                                                                删除
                                                            </Button>
                                                        </Popconfirm>

                                                    </Col>
                                                </Row>
                                                <Form.Item
                                                    {...restField}
                                                    label="产品以及解决方案名称"
                                                    name={[name, 'productName']}
                                                    rules={[{ required: true, message: '请选择产品以及解决方案名称' }]}
                                                    style={{ marginBottom: 20 }}
                                                >
                                                    <Select onChange={(value) => {
                                                        form.setFieldValue(["digitalContentList", name, 'connectService'], value)
                                                    }} mode="tags" placeholder="请选择产品以及解决方案名称" options={[
                                                        { value: "example1", label: "产品1" },
                                                        { value: "example2", label: "产品2" },
                                                        { value: "example3", label: "产品3" },
                                                        { value: "example4", label: "产品4" },
                                                    ]} />
                                                </Form.Item>
                                                <Form.Item
                                                    {...restField}
                                                    label="关联服务商"
                                                    name={[name, 'connectService']}
                                                    rules={[{ required: true, message: '请选择关联服务商' }]}
                                                    style={{ marginBottom: 20 }}
                                                >
                                                    <Select mode='tags' disabled placeholder="请选择关联服务商" options={[
                                                        { value: "example1", label: "产品1关联服务商" },
                                                        { value: "example2", label: "产品2关联服务商" },
                                                        { value: "example3", label: "产品3关联服务商" },
                                                        { value: "example4", label: "产品4关联服务商" },
                                                    ]} />
                                                </Form.Item>
                                                <Form.Item
                                                    {...restField}
                                                    label="关联服务商信用代码"
                                                    name={[name, 'craditCode']}
                                                    rules={[{ required: true, message: '请输入关联服务商信用代码' }]}
                                                    style={{ marginBottom: 20 }}
                                                >
                                                    <Input placeholder="请输入关联服务商信用代码" />
                                                </Form.Item>
                                                <Form.Item
                                                    {...restField}
                                                    label="数字化内容介绍"
                                                    name={[name, 'digitalContent']}
                                                    rules={[{ required: true, message: '请输入数字化内容介绍' }]}
                                                    style={{ marginBottom: 20 }}
                                                >
                                                    <TextArea
                                                        placeholder="请输入数字化内容介绍"
                                                        allowClear
                                                        showCount
                                                        maxLength={500}
                                                        style={{
                                                            minHeight: 120,
                                                            maxHeight: 200,
                                                            resize: 'vertical',
                                                            ...COMMON_FIELD_STYLE,
                                                        }}
                                                    />
                                                </Form.Item>
                                                <Form.Item
                                                    {...restField}
                                                    label="云应用"
                                                    name={[name, 'cloundApp']}
                                                    rules={[{ required: true, message: '请选择云应用' }]}
                                                    style={{ marginBottom: 20 }}
                                                >
                                                    <Select mode="multiple" style={COMMON_FIELD_STYLE}>
                                                        <Select.Option value="privateCloud">私有云</Select.Option>
                                                        <Select.Option value="publicCloud">公有云</Select.Option>
                                                        <Select.Option value="hybridCloud">混合云</Select.Option>
                                                        <Select.Option value="dedicatedCloud">专有云</Select.Option>
                                                        <Select.Option value="noCloud">未上云</Select.Option>
                                                    </Select>
                                                </Form.Item>
                                                <Form.Item
                                                    {...restField}
                                                    label="云应用情况描述"
                                                    name={[name, 'cloudDesc']}
                                                    // rules={[{ required: true, message: '请输入云应用情况描述' }]}
                                                    style={{ marginBottom: 20 }}
                                                >
                                                    <TextArea
                                                        placeholder="请输入云应用情况描述"
                                                        allowClear
                                                        showCount
                                                        maxLength={500}
                                                        style={{
                                                            minHeight: 120,
                                                            maxHeight: 200,
                                                            resize: 'vertical',
                                                            ...COMMON_FIELD_STYLE,
                                                        }}
                                                    />
                                                </Form.Item>
                                                <Form.Item
                                                    {...restField}
                                                    label="改造项目开始时间"
                                                    name={[name, 'programStart']}
                                                    rules={[{ required: true, message: '请选择改造项目开始时间' }]}
                                                    style={{ marginBottom: 20 }}
                                                >
                                                    <DatePicker />
                                                </Form.Item>
                                                <Form.Item
                                                    {...restField}
                                                    label="改造项目结束时间"
                                                    name={[name, 'programEnd']}
                                                    rules={[{ required: true, message: '请选择改造项目结束时间' }]}
                                                    style={{ marginBottom: 20 }}
                                                >
                                                    <DatePicker />
                                                </Form.Item>
                                                <Form.Item
                                                    {...restField}
                                                    label="改造项目单项花费 (万元)"
                                                    name={[name, 'programPay']}
                                                    rules={[{ required: true, message: '请输入改造项目单项花费 (万元)' }]}
                                                    style={{ marginBottom: 20 }}
                                                >
                                                    <Input placeholder="请输入改造项目单项花费 (万元)" />
                                                </Form.Item>
                                                <Form.Item
                                                    {...restField}
                                                    label="改造合同"
                                                    name={[name, 'changeContract']}
                                                    rules={[{ required: true, message: '请选择改造合同' }]}
                                                    style={{ marginBottom: 20 }}
                                                >
                                                    <Upload
                                                        name="contract"
                                                        fileList={hetongList[["digitalContentList", name, 'changeContract'].join("_") as any]}
                                                        beforeUpload={(file) => {
                                                            handleAutoUpload(file, ["digitalContentList", name, 'changeContract']);
                                                            return false;
                                                        }}
                                                        // action="/upload.do"
                                                        listType="text"
                                                        maxCount={1}
                                                        style={COMMON_FIELD_STYLE}
                                                    >
                                                        <Button icon={<UploadOutlined />}>点击上传改造合同</Button>
                                                    </Upload>
                                                </Form.Item>
                                                {/* 
                                <Form.Item
                                  label="数字化改造需求"
                                  {...restField}
                                  style={{ marginBottom: 20 }}
                                >
                                  <Button
                                    style={{ width: '100%' }}
                                    onClick={() => setSenceList((prev) => [...prev, prev.length + 1])}
                                  >
                                    +新增场景
                                  </Button>
                                </Form.Item> */}
                                                {senceList.map((item, index) => (
                                                    <div
                                                        key={item}
                                                        style={{
                                                            marginBottom: 24,
                                                            borderBottom: '1px solid #e8e8e8',
                                                            paddingBottom: 16,
                                                        }}
                                                    >
                                                        <Row justify="space-between" align="middle">
                                                            <Col>
                                                                <div
                                                                    style={{
                                                                        fontSize: 16,
                                                                        fontWeight: 500,
                                                                        color: '#1f2937',
                                                                        marginBottom: 12,
                                                                    }}
                                                                >
                                                                    场景 {item}
                                                                </div>
                                                            </Col>
                                                            <Col>
                                                                <Popconfirm title="是否删除" onConfirm={() => {
                                                                    setSenceList((prev) => prev.filter((_, idx) => idx !== index));
                                                                }}>
                                                                    <Button
                                                                        type="link"
                                                                        danger
                                                                    >
                                                                        删除
                                                                    </Button>
                                                                </Popconfirm>

                                                            </Col>
                                                        </Row>

                                                        <Form.Item
                                                            {...restField}
                                                            label={`对应的数字化改造需求`}
                                                            name={[name, item, 'scene']}
                                                            rules={[{ required: true, message: `请对应的数字化改造需求` }]}
                                                            style={{ marginBottom: 20 }}
                                                        >
                                                            <TreeSelect
                                                                allowClear
                                                                placeholder="请对应的数字化改造需求"
                                                                style={COMMON_FIELD_STYLE}
                                                                treeData={condition.map((node) => convertNode(node))}
                                                                treeDefaultExpandAll
                                                                showSearch
                                                                onChange={(value) => {
                                                                    if (value) {
                                                                        const fullPath = fullPathMap[value].join(' / ');
                                                                        form.setFieldValue(['scenes', name, item, 'scene'], fullPath);
                                                                    }
                                                                }}
                                                            />
                                                        </Form.Item>

                                                        <Form.Item
                                                            {...restField}
                                                            label={`场景描述`}
                                                            name={[name, item, 'sceneDesc']}
                                                            rules={[{ required: true, message: `请输入场景描述` }]}
                                                            style={{ marginBottom: 20 }}
                                                        >
                                                            <TextArea
                                                                placeholder={`${item}请输入场景描述`}
                                                                allowClear
                                                                showCount
                                                                maxLength={500}
                                                                style={{
                                                                    minHeight: 120,
                                                                    maxHeight: 200,
                                                                    resize: 'vertical',
                                                                    ...COMMON_FIELD_STYLE,
                                                                }}
                                                            />
                                                        </Form.Item>
                                                    </div>
                                                ))}
                                            </div>
                                        ))}

                                        <Form.Item wrapperCol={{ offset: 5, span: 19 }} style={{ marginTop: 40, textAlign: "center" }}>
                                            <Button type="primary" onClick={() => add()} >
                                                +新增数字化改造内容
                                            </Button>
                                        </Form.Item>
                                    </>
                                )}
                            </Form.List>
                        </div>

                        <div style={{ marginBottom: 24 }}>
                            <div style={{ borderBottom: '1px solid #e8e8e8', marginBottom: 20 }}></div>

                            <div
                                style={{
                                    fontSize: 16,
                                    fontWeight: 500,
                                    color: '#1f2937',
                                    marginBottom: 12,
                                }}
                            >
                                预期成效
                            </div>

                            <Form.Item
                                name="innovationDimension"
                                label="创新维度"
                                rules={[{ required: true, message: '请输入创新维度' }]}
                                style={{ marginBottom: 20 }}
                            >
                                {/* <Input style={COMMON_FIELD_STYLE} /> */}
                                <TextArea
                                    placeholder="请输入创新维度"
                                    allowClear
                                    showCount
                                    maxLength={500}
                                    style={{
                                        minHeight: 120,
                                        maxHeight: 200,
                                        resize: 'vertical',
                                        ...COMMON_FIELD_STYLE,
                                    }}
                                />
                            </Form.Item>

                            <Form.Item
                                name="marketDimension"
                                label="市场维度"
                                rules={[{ required: true, message: '请输入市场维度' }]}
                                style={{ marginBottom: 20 }}
                            >
                                {/* <Input style={COMMON_FIELD_STYLE} /> */}
                                <TextArea
                                    placeholder="请输入市场维度"
                                    allowClear
                                    showCount
                                    maxLength={500}
                                    style={{
                                        minHeight: 120,
                                        maxHeight: 200,
                                        resize: 'vertical',
                                        ...COMMON_FIELD_STYLE,
                                    }}
                                />
                            </Form.Item>

                            <Form.Item
                                name="qualityImprovementDimension"
                                label="提质维度"
                                rules={[{ required: true, message: '请输入提质维度' }]}
                                style={{ marginBottom: 20 }}
                            >
                                {/* <Input style={COMMON_FIELD_STYLE} /> */}
                                <TextArea
                                    placeholder="请输入提质维度"
                                    allowClear
                                    showCount
                                    maxLength={500}
                                    style={{
                                        minHeight: 120,
                                        maxHeight: 200,
                                        resize: 'vertical',
                                        ...COMMON_FIELD_STYLE,
                                    }}
                                />
                            </Form.Item>

                            <Form.Item
                                name="costReductionDimension"
                                label="降本维度"
                                rules={[{ required: true, message: '请输入降本维度' }]}
                                style={{ marginBottom: 20 }}
                            >
                                {/* <Input style={COMMON_FIELD_STYLE} /> */}
                                <TextArea
                                    placeholder="请输入降本维度"
                                    allowClear
                                    showCount
                                    maxLength={500}
                                    style={{
                                        minHeight: 120,
                                        maxHeight: 200,
                                        resize: 'vertical',
                                        ...COMMON_FIELD_STYLE,
                                    }}
                                />
                            </Form.Item>

                            <Form.Item
                                name="efficiencyIncreaseDimension"
                                label="增效维度"
                                rules={[{ required: true, message: '请输入增效维度' }]}
                                style={{ marginBottom: 20 }}
                            >
                                {/* <Input style={COMMON_FIELD_STYLE} /> */}
                                <TextArea
                                    placeholder="请输入增效维度"
                                    allowClear
                                    showCount
                                    maxLength={500}
                                    style={{
                                        minHeight: 120,
                                        maxHeight: 200,
                                        resize: 'vertical',
                                        ...COMMON_FIELD_STYLE,
                                    }}
                                />
                            </Form.Item>

                            <Form.Item
                                name="greenDimension"
                                label="绿色维度"
                                rules={[{ required: true, message: '请输入绿色维度' }]}
                                style={{ marginBottom: 20 }}
                            >
                                {/* <Input style={COMMON_FIELD_STYLE} /> */}
                                <TextArea
                                    placeholder="请输入绿色维度"
                                    allowClear
                                    showCount
                                    maxLength={500}
                                    style={{
                                        minHeight: 120,
                                        maxHeight: 200,
                                        resize: 'vertical',
                                        ...COMMON_FIELD_STYLE,
                                    }}
                                />
                            </Form.Item>

                            <Form.Item
                                name="safetyDimension"
                                label="安全维度"
                                rules={[{ required: true, message: '请输入安全维度' }]}
                                style={{ marginBottom: 20 }}
                            >
                                {/* <Input style={COMMON_FIELD_STYLE} /> */}
                                <TextArea
                                    placeholder="请输入安全维度"
                                    allowClear
                                    showCount
                                    maxLength={500}
                                    style={{
                                        minHeight: 120,
                                        maxHeight: 200,
                                        resize: 'vertical',
                                        ...COMMON_FIELD_STYLE,
                                    }}
                                />
                            </Form.Item>

                            <Form.Item
                                name="otherDimension"
                                label="其他维度"
                                rules={[{ required: true, message: '请输入其他维度' }]}
                                style={{ marginBottom: 20 }}
                            >
                                {/* <Input style={COMMON_FIELD_STYLE} /> */}
                                <TextArea
                                    placeholder="请输入其他维度"
                                    allowClear
                                    showCount
                                    maxLength={500}
                                    style={{
                                        minHeight: 120,
                                        maxHeight: 200,
                                        resize: 'vertical',
                                        ...COMMON_FIELD_STYLE,
                                    }}
                                />
                            </Form.Item>
                        </div>
                        <Form.Item label={null} style={{ marginTop: 40, textAlign: 'center' }}>

                            {/* <Button
                                type="primary"
                                style={{ marginRight: 10 }}
                            >
                                暂存
                            </Button> */}

                            <Button style={{}} type="primary"
                                onClick={handleSubmit}
                            >
                                提交
                            </Button>
                        </Form.Item>
                    </Form>
                </div>
            </div>
        </Modal>
    )
}

export default DigitalFormModal;